home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / adaed-1.11 / adaed-1 / Adaed-1.11.0a / adared.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-07  |  1.7 KB  |  51 lines

  1.  
  2. /*
  3.  * Copyright (C) 1985-1992  New York University
  4.  * 
  5.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  6.  * warranty (none) and distribution info and also the GNU General Public
  7.  * License for more details.
  8.  
  9.  */
  10.  
  11. #include "ada.h"
  12.  
  13. #define SPAN(node) get_left_span(node),get_right_span(node)
  14.  
  15. /* Macros for convenient use of the rh array:
  16. AST(n) represents the node in the nth position of the rh array (non-terminal).
  17. IND(n) repesents the index of the terminal in the nth position of the rh
  18. array.
  19. LOC(n) represents the starting location of the terminal in the nth position 
  20. of the rh array.
  21. END_LOC(n) represents the ending location of the terminal in the nth position 
  22. of the rh array.
  23. */
  24. #define AST(j) (rh[j]->ptr.ast)
  25. #define IND(j) (rh[j]->ptr.token->index)
  26. #define LOC(j) (&rh[j]->ptr.token->loc)
  27. #define END_LOC(j)     \
  28.     make_span(LOC(j)->line,LOC(j)->col+strlen(namelist(IND(j)))-1)
  29.  
  30.  
  31.  
  32. /* FREEAST recursively frees the nth child of node and its children. */
  33. #define FREEAST(node,n) {if ((node->links.subast)[n] != opt_node) \
  34.     free_everything((node->links.subast)[n]);}
  35.  
  36.  
  37. /* These macros are just to make coding easier */
  38. #define NAST1 node->links.subast = new_ast1
  39. #define NAST2 node->links.subast = new_ast2
  40. #define NAST3 node->links.subast = new_ast3
  41. #define NAST4 node->links.subast = new_ast4
  42. #define NN(kind) node = new_node(kind)
  43.  
  44.  
  45. /* The following 2 macros are for looping through a circular linked list of
  46.    structs of type two_pool. list is the list to go through, and var is
  47.    the variable name to be used for the current element of the list. */
  48. #define LLOOPTOP(list,var) {if (list != NULL) {struct two_pool *bottom, *var;\
  49.     var = bottom = list; do     { var = var->link;
  50. #define LLOOPBOTTOM(var) } while (var != bottom); }}
  51.